package com.example.plugin.utils;

import java.io.File;

public class FileUtils {

	public static void cleanDir(File dir) {
		cleanDir(dir, false);
	}

	public static void cleanDir(File dir, boolean cleanSelf) {
		if (dir.isDirectory()) {
			File[] files = dir.listFiles();
			if (files != null) {
				for (File file : files) {
					cleanDir(file, true);
				}
			}
		} else {
			dir.delete();
		}
		
		if (cleanSelf) {
			dir.delete();
		}
	}

}
